#ifndef GAMEMANAGER_HH
#define GAMEMANAGER_HH
/*
The GameManager class serves as the central controller for the game, orchestrating player interactions, dungeon navigation, combat mechanics, and victory conditions.
It manages the game loop (gameLoop), which drives the progression of the game by repeatedly updating the player’s state, processing user commands, 
and checking for game-ending conditions.
More explains about the game will be in the README.md file!
*/
/*
* GameManager类作为游戏核心控制器，统筹管理以下模块：
* - 玩家交互系统
* - 地牢导航逻辑
* - 战斗机制实现
* - 胜利条件判定
* 通过gameLoop方法驱动游戏主循环，该循环通过以下操作推进游戏进程：
* 1. 持续更新玩家状态
* 2. 处理用户输入指令
* 3. 检测游戏结束条件
* 详细游戏说明请参阅README.md文档
*/
#include "Player.hh"
#include "Room.hh"
#include "DungeonMap.hh"
#include <vector>
#include <map>
#include <string>

namespace DungeonRPG {

class GameManager {
private:
    Player* player;
    std::vector<Room*> rooms;
    Room* currentRoom;
    unsigned exploredCount = 0;
    DungeonMap* map;
    int playerX = 0;
    int playerY = 0;
    std::string victoryMode;
    int torchlight = 12; // max light level
    std::map<std::pair<int, int>, Room*> roomMap;

public:
    GameManager();
    ~GameManager();

    void setup();
    void gameLoop();
    void displayMainMenu();
    void handlePlayerCommand();
    void enterBattle(Enemy* enemy);
    bool allEnemiesDefeated() const;
    bool isVictoryConditionMet() const;
    void clearScreen() const ;
    void enterShop();
    void enterTreasureRoom();
    void consumeTorch();
    void adjustTorch(int delta);
    void displayTorchStatus() const;
    
};

}

#endif
